<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="/static/css/index.css">

</head>
<body>
<div class="all" id="dataDisplay">
	<!-- 导航部分 -->
	<div class="sidebar">
		<div class="nav">
            <a id="jifangLink" href="javascript:void(0);"><img src="/static/img/home.png">机房信息</a>
            <a id="cunchuLink" href="javascript:void(0);"><img src="/static/img/skills.png">存储信息</a>
        </div>
	</div>
	<!-- 导航结束 -->
	<!-- 首页 -->
	<div class="content">
        <table>
            <tr>
            	<td colspan="6" class="jifang" >
            	<a  href="https://10.106.134.15:31943/login/login.action?target=https%3A%2F%2F10.106.134.15%3A31943%2Findex.html" style="color: black; text-decoration: none;" target="_blank">1号楼机房</a>
            	</td>
            </tr>
            <tr>
                <td class="td_bg">平均湿度</td>
                <td colspan="2">{{ humiavg }} %</td>
                <td class="td_bg">最大湿度</td>
                <td colspan="2">{{ humimax }} %</td>
            </tr>
            <tr>
                <td class="td_bg">平均温度</td>
                <td colspan="2">{{ tempavg }} ℃</td>
                <td class="td_bg">最大温度</td>
                <td colspan="2">{{ tempmax }} ℃</td>
            </tr>
            <tr>
                <td class="td_bg">告警信息</td>
                <td colspan="5">{{ combined_string }}</td>
            </tr>
            <tr>
                <td class="td_bg">A模块UPS 供电状态</td>
                <td colspan="2">{{ second_last_value }}</td>
                <td class="td_bg">A UPS 后备时间</td>
                <td colspan="2">{{ last_value }} 分钟</td>
            </tr>
            <tr>
                <td class="td_bg">B模块UPS 供电状态</td>
                <td colspan="2">{{ B_UPS_status }}</td>
                <td class="td_bg">B UPS 后备时间</td>
                <td colspan="2">{{ B_time_value }} 分钟</td>
            </tr>
        </table>
        <!-- 11号楼机房 -->
        <table>
            <tr>
                <td colspan="6" class="jifang">
                	<a href="https://10.106.134.15:31943/login/login.action?target=https%3A%2F%2F10.106.134.15%3A31943%2Findex.html" style="color: black; text-decoration: none;" target="_blank">11号楼机房</a>
                </td>
            </tr>
            <tr>
                <td class="td_bg">平均湿度</td>
                <td colspan="1">{{ avg_sd }} %</td>
                <td class="td_bg">最大湿度</td>
                <td colspan="1">{{ max_sd }} %</td>
                <td class="td_bg">南侧空调温度设定</td>
                <td colspan="1">{{ nckt_wdsd_value }} %</td>

            </tr>
            <tr>
                <td class="td_bg">平均温度</td>
                <td colspan="1">{{ avg_wd }} ℃</td>
                <td class="td_bg">最大温度</td>
                <td colspan="1">{{ max_wd }} ℃</td>
                <td class="td_bg">北侧空调温度设定</td>
                <td colspan="1">{{ bckt_wdsd_value }} ℃</td>
            </tr>
            <tr>
                <td class="td_bg">告警信息</td>
                <td colspan="5" class="left-align">{{  alarm_value }}</td>
            </tr>
            <tr class="td_bg">
                <td>UPS名称</td>
                <td>供电状态</td>
                <td>电池续航时间</td>
                <td>锂电池组电压</td>
                <td>锂电池寿命</td>
                <td>电池剩余容量</td>
            </tr>
            <tr>
                <td class="td_bg">11号楼南侧_UPS-A</td>
                <td >{{  UPSA_gdzt_value }} </td>
                <td>{{ UPSA_bdsj_value }} </td>
                <td>{{ UPSA_dcdy_value }} </td>
                <td>{{ dianchi_nance_A_soh_value }} </td>
                <td>{{ UPSA_syrl_value }} </td>
            </tr>
            <tr>
                <td class="td_bg">11号楼南侧_UPS-B</td>
                <td >{{  UPSB_gdzt_value }} </td>
                <td>{{ UPSB_bdsj_value }} </td>
                <td>{{  UPSB_dcdy_value }} </td>
                <td>{{  dianchi_nance_B_soh_value }} </td>
                <td>{{ UPSB_syrl_value }} </td>
            </tr>
            <tr>
                <td class="td_bg">11号楼北侧机房UPS</td>
                <td >{{ UPS_beice_gdzt_value }} </td>
                <td>{{ UPS_beice_bdsj_value }} </td>
                <td>{{ UPS_beice_dcdy_value }} </td>
                <td>{{ dianchi_beice_soh_value }} </td>
                <td>{{ UPS_beice_syrl_value }} </td>
            </tr>
            <tr>
                <td class="td_bg">摄像头监控是否正常</td>
                <td contenteditable="true" required colspan="5"> </td>
            </tr>
        </table>
        <!-- 内乡专有云 -->
        <table>
            <tr>
                <td colspan="6" class="jifang">
                <a href="https://10.144.1.11:31943/unisso/login.action?service=%2Funisess%2Fv1%2Fauth%3Fservice%3D%252Fnetecoportal%252Fassets%252Fbuild%252Findex.html&decision=1#/pages/dc/view/_t=1695346188781/st1695346198801/NE=33554433/25d/topo/" style="color: black; text-decoration: none;" target="_blank">
                    内乡专有云
                </a>
                </td>
            </tr>
            <tr>
                <td class="td_bg">平均湿度</td>
                <td colspan="2"> <input type="text" name="averageHumidity" placeholder="请输入平均湿度" required>%</td>
                <td class="td_bg">最大湿度</td>
                <td colspan="2"> <input type="text" name="maxHumidity" placeholder="请输入最大湿度" required>%</td>
            </tr>
            <tr>
                <td class="td_bg">平均温度</td>
                <td colspan="2"> <input type="text" name="averagewendu" placeholder="请输入平均温度" required>℃</td>
                <td class="td_bg">最大温度</td>
                <td colspan="2"> <input type="text" name="averageshidu" placeholder="请输入最大温度" required>℃</td>
            </tr>
            <tr>
                <td class="td_bg">环控有无告警</td>
                <td contenteditable="true" required colspan="5"> </td>
            </tr>
            <tr>
                <td class="td_bg">摄像头监控是否正常，监控主机：10.110.1.250</td>
                <td contenteditable="true" required colspan="5"> </td>
            </tr>
        </table>
    </div>
</div>

<script>
document.getElementById('jifangLink').addEventListener('click', function() {
    fetch('/data')
        .then(response => response.json())
        .then(data => {
            // 在这里处理获取的机房数据
            // 例如，将数据显示在 dataDisplay 元素中
            const displayElement = document.getElementById('dataDisplay');
            displayElement.innerHTML = '<pre>' + JSON.stringify(data, null, 2) + '</pre>';
        })
        .catch(error => {
            console.error('Error fetching data: ', error);
        });
});

document.getElementById('cunchuLink').addEventListener('click', function() {
    fetch('cunchu.html')
        .then(response => response.text())
        .then(data => {
            // 处理存储数据
            alert(data);  // 或其他逻辑
        })
        .catch(error => {
            console.error('Error fetching data: ', error);
        });
});
</script>
</body>
</html>